<template>
	<view class="mycontent">
		<image src="@/static/myhead.png" style="width: 100%;" :style="'height:' + (topDis * 2 + 276) + 'rpx'"></image>
		<view class="head flex-ac" :style="'top:' + (topDis*2 - 10) + 'px'">
			<view class="left" style="flex: 1;">
				<image src="@/static/head.png" alt="" style="width: 110rpx;height: 110rpx;">
					<view>
						<view class="titlename">{{detail.simpleUserInfo.nickName}}-{{detail.simpleUserInfo.phone}}</view>
						<!-- <view class="titlename">{{detail.simpleUserInfo.nickName}}</view>
						<view class="phone">{{detail.simpleUserInfo.phone}}</view> -->
						<view class="status">已启用</view>
					</view>
			</view>
			<view class="right" @click="myDetail">
				查看资料 <image src="@/static/iconright.png" style="width: 40rpx;height: 40rpx;" alt="">
			</view>
		</view>

		<view class="mianBody">
			<view class="itemcard" v-for='(item,index) in list' :key="index">
				<view @click="change(item.click)">
					<image :src="item.img" alt="" style="width: 60rpx;height: 60rpx;"></image>
					<p>{{item.name}}</p>
				</view>
			</view>
		</view>

		<u-modal @confirm='confirm' @cancel='cancel' confirmColor='#57955f' cancelText='否' confirmText='是' :show="show"
			:content='content' width="600rpx" :showCancelButton='true'
			style="text-align: center;line-height: 60rpx;"></u-modal>
	</view>
</template>

<script>
	import {
		ysxy
	} from '../../utils/api.js'
	import {
		login,
		detail,
		getFileAuthPath
	} from '../../utils/api.js'
	export default {
		data() {
			return {
				show: false,
				topDis: this.$app.globalData.topDis,
				detail: '',
				content: '',
				list: [{
						name: '二维码',
						img: require('@/static/ewm.png'),
						click: 'code'
					},
					{
						name: '联系客服',
						img: require('@/static/lxkf.png'),
						click: 'service'
					},
					{
						name: '用户协议',
						img: require('@/static/yhxy.png'),
						click: 'user'
					},
					{
						name: '隐私政策',
						img: require('@/static/yscl.png'),
						click: 'privacy'
					},
					{
						name: '退出登录',
						img: require('@/static/tcdl.png'),
						click: 'loginOut'
					}
				],
			}
		},
		onShow() {
			this.getOrzDetail()
			this.detail = JSON.parse(uni.getStorageSync('loginUser'))
		},
		methods: {
			getOrzDetail(){
				detail().then(val => {
					let detail = JSON.stringify(val.data)
					uni.setStorageSync('detail', detail)
				}).catch(err => {
					uni.$u.toast('医疗机构信息获取失败！')
				})
			},
			changeTab(item) {
				this.targertIndex = item.index
				console.log("0000", item)
			},
			myDetail() {
				uni.navigateTo({
					url: '/pages/Mydetail/Mydetail'
				})
			},
			change(item) {
				console.log(item)
				switch (item) {
					case 'code':
						this.code()
						break;
					case 'privacy':
						this.privacy()
						break;
					case 'user':
						this.user()
						break;
					case 'loginOut':
						this.loginOut()
						break;
					case 'service':
						this.service()
						break;

				}
			},
			code() {
				uni.navigateTo({
					url: '/pages/Code/Code'
				})
			},
			service() {
				this.content = `是否拨打客服联系电话\n023-63897878？`
				this.show = true;
			},

			confirm() {
				this.show = false
				uni.makePhoneCall({
					phoneNumber: '023-63897878', // 要拨打的电话号码
					success: function() {
						console.log('拨打电话成功！');
					},
					fail: function(err) {
						console.log('拨打电话失败，原因：' + err.errMsg);
					}
				});
			},
			cancel() {
				this.show = false
			},
			privacy() {
				uni.navigateTo({
					url: '/pages/yscl/yscl'
				})
			},
			user() {
				uni.navigateTo({
					url: '/pages/yhxy/yhxy'
				})
			},
			loginOut() {
				uni.showModal({
					title: '提示',
					content: '是否要退出登录？',
					success: function(res) {
						if (res.confirm) {
							uni.clearStorage()
							uni.navigateTo({
								url: '/pages/login/login'
							})
						}
					}
				});
			},
		}
	}
</script>

<style scoped lang="less">
	.head {
		width: 750rpx;
		height: 190rpx;
		position: fixed;
		z-index: 1;
		// background: url(@/static/myhead.png) no-repeat;
		background-size: 100% 100%;
		margin: 0rpx;
		box-sizing: border-box;
		padding: 0rpx 30rpx;
		display: flex;
	}

	.mianBody {
		width: 750rpx;
		// height: 330rpx;
		background: #ffffff;
		position: relative;
		top: -10rpx;
		display: flex;
		flex-wrap: wrap;
		// gap: 0rpx 40rpx;
		padding: 40rpx 28rpx;

	}


	.left {
		display: flex;
		align-items: center;
		gap: 20rpx;


	}

	.status {
		background: #3db02020;
		border-radius: 4rpx;
		width: 100rpx;
		padding: 6rpx;
		font-size: 26rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: Regular;
		text-align: center;
		color: #3db020;

	}

	h3 {
		line-height: 60rpx;
	}

	.right {
		// flex: 1;
		padding-right: 20rpx;
		font-size: 26rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: Regular;
		text-align: left;
		color: #999999;
		display: flex;
		align-items: center;
		position: relative;
		left: 44rpx;
	}

	.itemcard {
		text-align: center;
		width: 172rpx;
		margin-bottom: 50rpx;
	}
	.itemcard:last-child{
		margin-bottom: 0;
	}

	p {
		font-size: 26rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: Regular;
		text-align: center;
		color: #333333;
	}

	.titlename {
		font-size: 34rpx;
		font-family: PingFang SC, PingFang SC-Semibold;
		font-weight: bold;
		text-align: left;
		color: #3f4151;
		line-height: 60rpx;
	}
	.phone{
		font-size: 30rpx;
		font-family: PingFang SC, PingFang SC-Semibold;
		// font-weight: bold;
		text-align: left;
		color: #3f4151;
	}
</style>